<?php


namespace App\Mailer;

use App\Models\User;
use Auth;

class UserMailer extends Mailer
{
    //密码重置
    public function passwordReset($email, $token)
    {
        $data = [
            'url' => url('password/reset', $token)
        ];

        $this->sendTo('larabbs_password_reset', $email, $data);
    }

    //用户注册
    public function welcome(User $user)
    {
        $data = [
            'url' => route('email.verify', ['token' => $user->confirmation_token]),
            'name' => $user->name
        ];
        $this->sendTo('larabbs_register', $user->email, $data);
    }

    // 用户回复
    public function reply($replyNotification)
    {
        //$replyNotification = [
        //    'topic_user_email' => $this->topic->user->email,
        //    'reply_user' => $this->reply->user->name,
        //    'topic_link' => $this->link,
        //    'topic_title' => $this->topic->title,
        //    'reply_content' => $this->reply->content
        //];
        $data = [
            'topic_link' => url($replyNotification['topic_link']),
            'reply_user' => $replyNotification['reply_user'],
            'topic_title' => $replyNotification['topic_title'],
            'reply_content' => $replyNotification['reply_content'],
        ];
        $this->sendTo('larabbs_reply', $replyNotification['topic_user_email'], $data);
    }
}